package com.gp.node.operator;

import com.gp.node.INode;
import com.stock.StockData;

public class Pow extends IOperatorBinary {
	
	private static final long serialVersionUID = 5178965900196840722L;

	@Override
	public double getValue(StockData stock) {
		return Math.pow(right.getValue(stock), left.getValue(stock));
	}

	@Override
	public INode createNew()  {
		 return new Pow();
	}
	
	@Override
	public INode copy() {
		Pow node = new Pow();
		node.setByCopy(this);
		return node;
	}
	
	@Override
	public String print(StockData stock) {
		return "(" + right.print(stock) + ") ^ (" + left.print(stock) + ")";
	}
	
	@Override
	public String print() {
		return "(" + right.print() + ") ^ (" + left.print() + ")";
	}

}
